import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/banner_model_entity.dart';

BannerModelEntity $BannerModelEntityFromJson(Map<String, dynamic> json) {
  final BannerModelEntity bannerModelEntity = BannerModelEntity();
  final String? bannerId = jsonConvert.convert<String>(json['bannerId']);
  if (bannerId != null) {
    bannerModelEntity.bannerId = bannerId;
  }
  final int? bannerType = jsonConvert.convert<int>(json['bannerType']);
  if (bannerType != null) {
    bannerModelEntity.bannerType = bannerType;
  }
  final String? coverEnUrl = jsonConvert.convert<String>(json['coverEnUrl']);
  if (coverEnUrl != null) {
    bannerModelEntity.coverEnUrl = coverEnUrl;
  }
  final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']);
  if (coverUrl != null) {
    bannerModelEntity.coverUrl = coverUrl;
  }
  final String? enName = jsonConvert.convert<String>(json['enName']);
  if (enName != null) {
    bannerModelEntity.enName = enName;
  }
  final String? enWebLink = jsonConvert.convert<String>(json['enWebLink']);
  if (enWebLink != null) {
    bannerModelEntity.enWebLink = enWebLink;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    bannerModelEntity.name = name;
  }
  final String? newsId = jsonConvert.convert<String>(json['newsId']);
  if (newsId != null) {
    bannerModelEntity.newsId = newsId;
  }
  final String? newsTitle = jsonConvert.convert<String>(json['newsTitle']);
  if (newsTitle != null) {
    bannerModelEntity.newsTitle = newsTitle;
  }
  final String? newsType = jsonConvert.convert<String>(json['newsType']);
  if (newsType != null) {
    bannerModelEntity.newsType = newsType;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    bannerModelEntity.sort = sort;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    bannerModelEntity.status = status;
  }
  final String? webLink = jsonConvert.convert<String>(json['webLink']);
  if (webLink != null) {
    bannerModelEntity.webLink = webLink;
  }
  return bannerModelEntity;
}

Map<String, dynamic> $BannerModelEntityToJson(BannerModelEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['bannerId'] = entity.bannerId;
  data['bannerType'] = entity.bannerType;
  data['coverEnUrl'] = entity.coverEnUrl;
  data['coverUrl'] = entity.coverUrl;
  data['enName'] = entity.enName;
  data['enWebLink'] = entity.enWebLink;
  data['name'] = entity.name;
  data['newsId'] = entity.newsId;
  data['newsTitle'] = entity.newsTitle;
  data['newsType'] = entity.newsType;
  data['sort'] = entity.sort;
  data['status'] = entity.status;
  data['webLink'] = entity.webLink;
  return data;
}

extension BannerModelEntityExt on BannerModelEntity {
  BannerModelEntity copyWith({
    String? bannerId,
    int? bannerType,
    String? coverEnUrl,
    String? coverUrl,
    String? enName,
    String? enWebLink,
    String? name,
    String? newsId,
    String? newsTitle,
    String? newsType,
    int? sort,
    int? status,
    String? webLink,
  }) {
    return BannerModelEntity()
      ..bannerId = bannerId ?? this.bannerId
      ..bannerType = bannerType ?? this.bannerType
      ..coverEnUrl = coverEnUrl ?? this.coverEnUrl
      ..coverUrl = coverUrl ?? this.coverUrl
      ..enName = enName ?? this.enName
      ..enWebLink = enWebLink ?? this.enWebLink
      ..name = name ?? this.name
      ..newsId = newsId ?? this.newsId
      ..newsTitle = newsTitle ?? this.newsTitle
      ..newsType = newsType ?? this.newsType
      ..sort = sort ?? this.sort
      ..status = status ?? this.status
      ..webLink = webLink ?? this.webLink;
  }
}